home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 70
/
070.d81
/
screen demo
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-08-26
|
9KB
|
473 lines
10 sys57812"screenmaster.o",8,0:poke780,0:poke781,0:poke782,192:sys65493
20 sys49152
30 color 3,0,0:printchr$(142)chr$(8)
40 print"[147] s c r e e n m a s t e r"
50 printtab(18)"d e m o"
60 :
70 rem: read window words
80 :
90 dim wc$(3,7)
100 dim dr$(144)
110 dim gn$(100),cm$(100),gb$(100)
120 :
130 for i=1 to 3
140 read wc$(1,i)
150 next
160 :
170 for i=1 to 7
180 read wc$(2,i)
190 next
200 :
210 for i=1 to 4
220 read wc$(3,i)
230 next
240 :
400 :
410 rem: get window to open
420 :
430 gosub 550
440 get a$:if a$="" then 440
450 if a$="d" then wn=1
460 if a$="c" then wn=2
470 if a$="h" then wn=3
480 if wn<>0 then gosub 1600
490 goto 440
500 :
510 :
520 rem: top window
530 rem: save copy to screen 3
540 :
550 locate 3,0
560 print"[129][213][178][178][178][178][178][178][178][178][178][178][178][178][178][178][178][178][178][178][178][178][178][178][178][178][178][178][178][178][178][178][178][178][178][178][178][178][178][178][201]";
570 fori=0to17:print"[221][221][221][221][221][221][221][221][221][221][221][221][221][221][221][221][221][221][221][221][221][221][221][221][221][221][221][221][221][221][221][221][221][221][221][221][221][221][221][221]";:next
580 print"[202][177][177][177][177][177][177][177][177][177][177][177][177][177][177][177][177][177][177][177][177][177][177][177][177][177][177][177][177][177][177][177][177][177][177][177][177][177][177][203]"
590 fori=217to242:pokei,peek(i)or128:next:rem fix line links
600 color 15,0,6
610 frame 2,0,0,2,0,39
620 home
630 print " d[146]irectory disk c[146]ommand h[146]elp";
640 wn=0
650 locate 23,6
660 print "enter d[155], c[155] or h[155] to open window"
670 pcopy 0,3
680 return
690 :
700 :
710 :
720 rem: disk window
730 :
740 frame 6,0,2,8,3,15
750 color 3,0,6
760 locate ft%+2,fl%+1
770 print wc$(1,1)
780 locate ft%+3,fl%+1
790 print wc$(1,2)
800 locate ft%+4,fl%+1
810 print wc$(1,3)
820 wn=1:rw=ft%+2
830 gosub 3320
840 goto 1660
850 :
860 :
870 rem: disk command window
880 :
890 frame 6,0,2,12,15,29
900 color 3,0,6
910 locate ft%+2,fl%+1
920 print wc$(2,1)
930 locate ft%+3,fl%+1
940 print wc$(2,2)
950 locate ft%+4,fl%+1
960 print wc$(2,3)
970 locate ft%+5,fl%+1
980 print wc$(2,4)
990 locate ft%+6,fl%+1
1000 print wc$(2,5)
1010 locate ft%+7,fl%+1
1020 print wc$(2,6)
1030 locate ft%+8,fl%+1
1040 print wc$(2,7)
1050 wn=2:rw=ft%+2
1060 gosub 3320
1070 goto 1660
1080 :
1090 :
1100 rem: help window
1110 :
1120 frame 6,0,2,9,28,39
1130 color 3,0,6
1140 locate ft%+2,fl%+1
1150 print wc$(3,1)
1160 locate ft%+3,fl%+1
1170 print wc$(3,2)
1180 locate ft%+4,fl%+1
1190 print wc$(3,3)
1200 locate ft%+5,fl%+1
1210 print wc$(3,4)
1220 wn=3:rw=ft%+2
1230 gosub 3320
1240 goto 1660
1250 :
1280 :
1290 rem: move cursor up and down
1300 :
1310 gosub 1830
1320 if a$="" then rw=rw+1
1330 if a$="[145]" then rw=rw-1
1340 if rw=fb%-1 then rw=ft%+2
1350 if rw=ft%+1 then rw=fb%-2
1360 gosub 1760
1370 goto 1660
1380 :
1390 :
1400 :
1410 rem: move window right and left
1420 :
1430 if a$="" then wn=wn+1
1440 if a$="[157]" then wn=wn-1
1450 if wn=0 then wn=3
1460 if wn=4 then wn=1
1470 pcopy 3,0
1480 goto 1600
1490 :
1500 :
1510 :
1520 rem: exit windows
1530 pcopy 3,0
1540 return
1550 :
1560 :
1570 :
1580 rem: open current window
1590 rem: after messed up
1600 on wn goto 740,890,1120
1610 :
1620 :
1630 :
1640 rem: control while in a window
1650 :
1660 gosub 1760
1670 get a$:if a$="" then 1670
1680 if a$="[157]" or a$="" then 1430
1690 if a$="" or a$="[145]" then 1310
1700 if a$=chr$(13) then 2280
1710 goto 1670
1720 :
1730 :
1740 rem: reverse cursor
1750 :
1760 locate rw,fl%+1
1770 print ""wc$(wn,rw-3);"[146]";
1780 return
1790 :
1800 :
1810 rem: un reverse cursor
1820 :
1830 locate rw,fl%+1
1840 print"[159]"wc$(wn,rw-3);
1850 return
1860 :
1870 :
1880 :
1890 rem: input a filename
1900 :
1910 pcopy 0,1
1920 j%=len(mg$)+4:if j%<20 then j%=20
1930 frame 2,0,10,15,8,j%+7
1940 :
1950 locate ft%+2,fl%+2
1960 print mg$
1970 locate ft%+4,fl%+2
1980 for i=1 to 16
1990 print "-";
2000 next
2010 :
2020 locate ft%+4,fl%+2
2030 ni=0:ff$=""
2040 :
2050 geta$:if a$="" then 2050
2060 if a$<>chr$(20)then 2130
2070 if ni=0 then 2050
2080 print "[157]-[157]";
2090 ni=ni-1
2100 ff$=left$(ff$,len(ff$)-1)
2110 goto 2050
2120 :
2130 if a$=chr$(13) then 2210
2140 if a$<" " or a$>"_" then 2050
2150 if ni=16 then 2050
2160 ni=ni+1
2170 print a$;
2180 ff$=ff$+a$
2190 goto 2050
2200 :
2210 pcopy 1,0
2220 return
2230 :
2240 :
2250 rem: determine which command
2260 rem: was picked
2270 :
2280 pcopy 0,1
2290 j=rw-3
2300 on wn goto 2310,2320,2330
2310 on j goto 3390,2470,2390
2320 on j goto 2690,2810,2990,2870,2930,3070,2390
2330 on j goto 5090,5270,5940,2390
2340 pcopy 1,0
2350 goto 1660
2360 :
2370 :
2380 rem: exit a window
2390 gosub 1830
2400 pcopy 3,0
2410 wn=0
2420 goto 440
2430 :
2440 :
2450 rem: quit program
2460 :
2470 color 0,0,0
2480 open15,8,15,"r0:hello connect=hello connect":input#15,er:close15
2490 ifer<>63thenprint"[159]":end
2500 print"[147]quit"
2510 print"load"chr$(34)"hello connect"chr$(34)",8"
2520 print"run"
2530 poke631,13:poke632,13:poke633,13:poke198,3:end
2540 :
2550 :
2560 rem: send disk command in dc$
2570 :
2580 open15,8,15,dc$
2590 input#15,a$,b$,c$,d$
2600 mg$=a$+" "+b$+"[160]"+c$+" "+d$
2610 gosub 3180
2620 gosub 3260
2625 print#15,dc$
2630 close15
2640 goto 1600
2650 :
2660 :
2670 rem: full new
2680 :
2690 mg$="enter new disk name"
2700 gosub 1910
2710 b$=ff$
2720 mg$="enter new disk id"
2730 gosub 1910
2740 dc$="n:"+b$+","+left$(ff$,2)
2750 goto 1670
2760 :
2770 :
2780 :
2790 rem: short new
2800 :
2810 dc$="n:"
2820 goto 1670
2830 :
2840 :
2850 rem: validate
2860 :
2870 dc$="v:"
2880 goto 2580
2890 :
2900 :
2910 rem: init disk
2920 :
2930 dc$="i:"
2940 goto 2580
2950 :
2960 :
2970 rem: delete
2980 :
2990 mg$="name of file to delete"
3000 gosub 1910
3010 dc$="s:"+ff$
3020 goto 1670
3030 :
3040 :
3050 rem: rename
3060 :
3070 mg$="old file name"
3080 gosub 1910
3090 b$=ff$
3100 mg$="new file name"
3110 gosub 1910
3120 dc$="r:"+ff$+"="+b$
3130 goto 2580
3140 :
3150 :
3160 rem: message window
3170 :
3180 pcopy 0,1
3190 l=int((40-len(mg$)-3)/2)
3200 r=l+len(mg$)+3
3210 frame 1,0,10,14,l,r
3220 locate ft%+2,fl%+2
3230 print mg$
3240 return
3250 :
3260 get a$:if a$="" then 3260
3270 pcopy 1,0
3280 return
3290 :
3300 :
3310 rem: print bottom help line
3320 locate 23,2
3330 print"crsr up[155]/down[155]/left[155]/right [155]then return "
3340 return
3350 :
3360 :
3370 rem: directory
3380 :
3390 mg$="reading directory"
3400 gosub 3180
3410 :
3420 open15,8,15,"i"
3430 open 1,8,0,"$0"
3440 :
3450 for i=1to30:get#1,a$:next
3460 :
3470 nf=0
3480 ff$=""
3490 get#1,a$:ifstthen3570
3500 ifa$<>chr$(34)then3480
3510 get#1,a$:ifstthen3570
3520 ifa$<>chr$(34)thenff$=ff$+a$:goto3510
3530 nf=nf+1
3540 dr$(nf)=ff$
3550 goto 3480
3560 :
3570 close1:close15
3580 :
3590 rem: directory window
3600 :
3610 pcopy 1,0
3620 tp=1
3630 frame 1,0,3,23,10,30
3640 locate fb%-2,fl%
3650 print "[171][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][179]"
3660 print "[159]"
3670 locate fb%-1,fl%+1
3680 print " e[146]xit crsr up/down"
3690 :
3700 :
3710 for i=1 to 17
3720 locate i+ft%,fl%+2
3730 if tp+i-1 >nf then i=17:goto 3750
3740 print dr$(tp+i-1)
3750 next
3760 :
3770 rem: control in directory
3780 :
3790 geta$:if a$="" then 3790
3800 if a$<>"" then 3860
3810 if tp+17>nf then 3790
3820 tp=tp+17
3830 clear
3840 goto 3640
3850 :
3860 if a$<>"[145]" then 3920
3870 if tp=1 then 3790
3880 tp=tp-17
3890 clear
3900 goto 3640
3910 :
3920 if a$<>"e" then 3790
3930 pcopy 1,0
3940 goto 1600
3950 :
3960 :
3970 :
3980 rem: print help options
3990 :
4000 if j=2 then :locate 24,10:print"e[146]xit cursor up/down";
4010 if j<>2 then :locate 24,17:print "e[146]xit";
4020 locate 0,0
4030 return
4040 :
4890 :
4900 rem: data for window choices
4910 :
4920 data " directory "," quit "
4930 data " escape "," full new "
4940 data " short new "
4950 data " delete file "
4960 data " validate "
4970 data " initialize "
4980 data " rename file "
4990 data " escape "
5000 data " general "," commands "
5010 data " grabber "," escape "
5020 :
5030 r